package org.zht.dormpro.dorm.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.zht.dormpro.dorm.model.TbTeacher;

public interface TbTeacherMapper {
    @Delete({
        "delete from tb_teacher",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into tb_teacher (id, tea_id, ",
        "tea_name, tea_age, ",
        "tea_image, tea_sex, ",
        "gras, tea_phone, ",
        "tea_append, tea_status)",
        "values (#{id,jdbcType=INTEGER}, #{teaId,jdbcType=VARCHAR}, ",
        "#{teaName,jdbcType=VARCHAR}, #{teaAge,jdbcType=TINYINT}, ",
        "#{teaImage,jdbcType=VARCHAR}, #{teaSex,jdbcType=TINYINT}, ",
        "#{gras,jdbcType=VARCHAR}, #{teaPhone,jdbcType=VARCHAR}, ",
        "#{teaAppend,jdbcType=VARCHAR}, #{teaStatus,jdbcType=TINYINT})"
    })
    int insert(TbTeacher record);

    int insertSelective(TbTeacher record);

    @Select({
        "select",
        "id, tea_id, tea_name, tea_age, tea_image, tea_sex, gras, tea_phone, tea_append, ",
        "tea_status",
        "from tb_teacher",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("org.zht.dormpro.dorm.mapper.TbTeacherMapper.BaseResultMap")
    TbTeacher selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TbTeacher record);

    @Update({
        "update tb_teacher",
        "set tea_id = #{teaId,jdbcType=VARCHAR},",
          "tea_name = #{teaName,jdbcType=VARCHAR},",
          "tea_age = #{teaAge,jdbcType=TINYINT},",
          "tea_image = #{teaImage,jdbcType=VARCHAR},",
          "tea_sex = #{teaSex,jdbcType=TINYINT},",
          "gras = #{gras,jdbcType=VARCHAR},",
          "tea_phone = #{teaPhone,jdbcType=VARCHAR},",
          "tea_append = #{teaAppend,jdbcType=VARCHAR},",
          "tea_status = #{teaStatus,jdbcType=TINYINT}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TbTeacher record);
}